import React from 'react';
import {
    ActivityIndicator,
    AsyncStorage,
    StatusBar,
    StyleSheet,
    View,
} from 'react-native';
import Ugame from '../../../Ugame';
export default class AuthLoading extends React.Component {
    static navigationOptions = {
        title: '',
        header: null,  //隐藏顶部导航栏
        tabBarVisible: false, // 隐藏底部导航栏
        headerStyle: {
            backgroundColor: '#f4511e',
        },
        headerTintColor: '#fff',
        headerTitleStyle: {
            fontWeight: 'bold',
        },
    }
    componentDidMount() {
        this._bootstrapAsync();
    }

    // Fetch the token from storage then navigate to our appropriate place
    _bootstrapAsync = async () => {
        const { navigation } = this.props;
        const target = navigation.getParam("target");
        this.props.navigation.navigate(Ugame.isLogin() ? target : 'Login');
    };

    // Render any loading content that you like here
    render() {
        return (
            <View>
                <ActivityIndicator />
                <StatusBar barStyle="default" />
            </View>
        );
    }
}